package com.ue.simple_calculator;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

import com.ue.simple_calculator.widget.CalcPanel;

public class MainActivity extends AppCompatActivity {
    private TextView tvResult;
    private TextView tvFormula;
    private CalcPanel viewCalcPanel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        tvFormula= (TextView) findViewById(R.id.tv_formula);
        tvResult= (TextView) findViewById(R.id.tv_result);
        viewCalcPanel= (CalcPanel) findViewById(R.id.view_calc_panel);

        viewCalcPanel.setOnCalcResultListener(new CalcPanel.OnCalcResultListener() {
            @Override
            public void onCalcResult(String formulaTxt, String result) {
                tvFormula.setText(formulaTxt);
                tvResult.setText(result);
            }
        });
    }
}
